<template>
<div ref="index_num">
    <Tabs :animated="false">
        <TabPane label="标签一">
            <h2>手写tab选项卡</h2>
            <!-- <div>
                <Child :sname="sname" :age="age" :type="type"></Child>
            </div> -->
        </TabPane>
        <TabPane label="标签二">标签二的内容</TabPane>
        <TabPane label="标签三">标签三的内容</TabPane>
    </Tabs>
    
</div>
</template>

<script>
import child from "@/components/self/child"
export default {
    name: 'tab-base',
    data() {
        return {
            sname: "提交",
            age: 18,
            type: "success",
            indexNumTop:0
        }
    },
    components: {
        child
    },
    mounted() {
        window.addEventListener('scroll', this.getScroll);
    },
    destroyed(){
        window.removeEventListener('scroll', this.getScroll);
    },
    methods: {
        //监听滚动
        getScroll(){
          console.log(232)
            this.indexNumTop = this.$refs.index_num.offset().top;
            this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
              if (!!document.documentElement.scrollTop &&document.documentElement.scrollTop >= 300){            
                // 设置滚动大于300时的执行内容
                console.log(1232)
            }
        }
　　}
}
</script>


